Capsule API Example
Loading...
Searching...
No Matches
CDefinesPrivate.h
Go to the documentation of this file.
1// Copyright. 2019 - 2024 PSBD. All rights reserved.
2
3#pragma once
4
5// This is a private header with API internal defines. No need to directly use/include this header to your project.
6
7//*****************************************************************************
8// Platform identification.
9//*****************************************************************************
10#ifdef _WIN64
11#define CC_PLATFORM_WIN 1
12#define CC_PLATFORM_WIN64 1
13#elif defined _WIN32 // defined for both 32 and 64 (so we check 64 first)
14#define CC_PLATFORM_WIN 1
15#define CC_PLATFORM_WIN32 1
16#elif __ANDROID__
17#define CC_PLATFORM_ANDROID 1
18#elif __APPLE__
19#define CC_PLATFORM_APPLE 1
20#include "TargetConditionals.h"
21#if TARGET_IPHONE_SIMULATOR
22#define CC_PLATFORM_IOS 1
23#define CC_PLATFORM_IOS_SIMULATOR 1
24#elif TARGET_OS_IPHONE
25#define CC_PLATFORM_IOS 1
26#elif TARGET_OS_MAC
27#define CC_PLATFORM_MAC 1
28#else
29#define CC_PLATFORM_APPLE_UNKNOWN 1
30#endif
31#elif __linux__
32#define CC_PLATFORM_LINUX 1
33#elif __unix__
34#define CC_PLATFORM_UNIX 1
35#else
36#define CC_PLATFORM_UNKNOWN 1
37#endif
38
39// Linkage macro.
40#if CC_PLATFORM_WIN
41#ifdef CL_DYNAMIC // in case we want a dynamic library
42#ifdef CL_EXPORT
43#define CL_DLL __declspec(dllexport)
44#else
45#define CL_DLL __declspec(dllimport)
46#endif
47#else // if static linkage, we don't export or import anything
48#define CL_DLL
49#endif
50#else // !CC_PLATFORM_WIN
51#define CL_DLL
52#endif
53
54#define CLC_STRUCT(Name) \
55 struct Name##d; \
56 typedef const struct Name##d* Name
57
58#ifdef __cplusplus
59#include <cstdint>
60#define NOEXCEPT noexcept
61
62#define CLC_CLASS_WN(Wrapped, Name) \
63 namespace capsule::client { \
64 class Wrapped; \
65 } \
66 typedef class capsule::client::Wrapped* Name
67
68#define CLC_STRUCT_WN(Wrapped, Name) \
69 namespace capsule::client { \
70 struct Wrapped; \
71 } \
72 typedef struct capsule::client::Wrapped const* Name
73
74#define CLC_STRUCT_WNN(Wrapped, Name, Namespace) \
75 namespace capsule::Namespace { \
76 struct Wrapped; \
77 } \
78 typedef struct capsule::Namespace::Wrapped const* Name
79
80#else
81#include <stdint.h>
82#define NOEXCEPT
83
84#define CLC_CLASS_WN(Wrapped, Name) \
85 struct clCWrapped##d; \
86 typedef struct clCWrapped##d* Name
87
88#define CLC_STRUCT_WN(Wrapped, Name) \
89 struct clCWrapped##d; \
90 typedef struct clCWrapped##d const* Name
91
92#endif //__cplusplus